package com.ruoyi.system.service.shopping.impl;

import com.ruoyi.system.domain.shopping.Area;
import com.ruoyi.system.domain.shopping.Category;
import com.ruoyi.system.mapper.shopping.AreaMapper;
import com.ruoyi.system.mapper.shopping.CategoryMapper;
import com.ruoyi.system.service.shopping.AreaService;
import com.ruoyi.system.service.shopping.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryServiceImpl implements CategoryService {

    @Autowired
    private CategoryMapper categoryMapper;
    @Override
    public List<Category> selectCategoryList(Category category) {
        List<Category> categories = categoryMapper.selectCategoryList(category);
        return categories;
    }

    @Override
    public Boolean add(Category category) {
        return categoryMapper.insert(category)>0;
    }

    @Override
    public Category selectCategoryById(Integer categoryId) {
        return categoryMapper.selectCategoryById(categoryId);
    }

    @Override
    public Boolean update(Category category) {
        System.out.println(category);
        return categoryMapper.update(category) >0;
    }

    @Override
    public Boolean deleteByIds(Integer[] categoryIds) {
        return categoryMapper.deleteByIds(categoryIds)>0;
    }
}
